﻿using System.Web;
using ElectronicCommerce.Framework.Utility;
using ElectronicCommerce.Framework.Web.Core;

namespace ElectronicCommerce.Framework.Web.Mvc
{
    public class CustomContextBase
    {
        public CustomContextBase()
        {
            Context = HttpContext.Current;

            Request = HttpContext.Current.Request;
            Response = HttpContext.Current.Response;

            CustomRequestContext = new CustomRequestContext(HttpContext.Current);
            HttpMethod = Converter.Enum<HttpMethodType>(Request.HttpMethod, HttpMethodType.Get);
        }

        /// <summary>
        /// HTTP Method
        /// </summary>
        public HttpMethodType HttpMethod { get; private set; }

        /// <summary>
        /// 请求上下文 (QueryString / Form / Cookie)
        /// </summary>
        public CustomRequestContext CustomRequestContext { get; private set; }


        public HttpContext Context { get; private set; }

        /// <summary>
        /// HttpRequest 对象
        /// </summary>
        public HttpRequest Request { get; private set; }
        public HttpResponse Response { get; private set; }
    }
}
